
package com.zjff.myshop.admin.pojo.form;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class GoodsInsertForm {

    @ApiModelProperty(value = "商品名称", position = 2, required = true)
    @NotEmpty(message = "商品名称不能为空")
    @Length(max = 128, message = "商品名称内容过长<=128 ")
    private String name;

    @ApiModelProperty(value = "商品规格", position = 3)
    @Length(max = 200, message = "商品规格内容过长<=200 ")
    private String spec;

    @ApiModelProperty(value = "分类id", position = 4, required = true)
    @NotNull(message = "分类id不能为空 ")
    @Min(value = 1, message = "分类id >= 1")
    private Integer categoryId;

    @ApiModelProperty(value = "商品图片", position = 5)
    private String img;

    @ApiModelProperty(value = "价格", position = 6, required = true)
    @NotNull(message = "价格不能为空 ")
    private BigDecimal price;

    @ApiModelProperty(value = "库存", position = 7, required = true)
    @NotNull(message = "库存不能为空 ")
    @Min(value = 1, message = "库存最低 >= 1 ")
    @Max(value = 100000, message = "库存最高 <= 100000 ")
    private Integer count;

    @ApiModelProperty(value = "商品状态: 1上架/0下架", position = 8, required = true)
    @NotNull(message = "商品状态不能为空 ")
    private Byte status;

    @ApiModelProperty(value = "商品卖点", position = 9)
    private String sellPoint;

    @ApiModelProperty(value = "商品详情", position = 10)
    private String content;

    @ApiModelProperty(value = "轮播图片数组", position = 11)
    private List<String> albumList;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "上架时间", position = 12)
    private Date createTime;

}